package org.jupiter.blog.service.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jupiter.blog.api.domain.JupiterUser;

import java.util.List;

@Mapper
public interface JupiterUserMapper {

	int insert(JupiterUser user);

	JupiterUser selectByUuid(@Param("uuid") String uuid);

	JupiterUser selectByUsernameOrEmail(@Param("username") String username, @Param("email") String email);

	int updateByUuidSelective(JupiterUser user);

	int deleteByUuid(@Param("uuid") String uuid);

	List<JupiterUser> selectByPage(
			@Param("username") String username,
			@Param("nickname") String nickname,
			@Param("email") String email,
			@Param("isActive") Boolean isActive,
			@Param("offset") int offset,
			@Param("limit") int limit
	);

	long countByQuery(
			@Param("username") String username,
			@Param("nickname") String nickname,
			@Param("email") String email,
			@Param("isActive") Boolean isActive
	);

	long countByUsername(@Param("username") String username);

	long countByEmail(@Param("email") String email);

	int restoreUser(@Param("uuid") String uuid);
}
